#include<iostream>
#include<memory>

class Log
{
public:
    virtual ~Log(){};
    virtual void recordLog()const {std::cout<<"LOG"<<std::endl;};
};

class FileLog:public Log
{
public:
    void recordLog()const override
    {
        std::cout<<"FileLog"<<std::endl;
    }
};


class DataBaseLog:public Log
{
public:
    void recordLog()const override
    {
        std::cout<<"DataBaseLog"<<std::endl;
    }
};

class Factory
{
public:
    virtual ~Factory(){};
    virtual std::shared_ptr<Log> createLog(void)const{};
};

class DataBaseLogFactory:public Factory
{
public:
    std::shared_ptr<Log> createLog(void)const override
    {
        return std::make_shared<DataBaseLog>();
    }
    
};

class FileLogFatcory:public Factory
{
public:
    std::shared_ptr<Log> createLog(void)const override
    {
        return std::make_shared<FileLog>();
    }
    
};





int main(int argc, char const *argv[])
{
    std::shared_ptr<Factory> fa (new FileLogFatcory);
    std::shared_ptr<Log> log (fa->createLog());
    log->recordLog();
    return 0;
}
